跳到主要内容

AddHyperlink

Adds a hyperlink to the specified range.

Syntax

expression.AddHyperlink(sLink, sScreenTipText);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sLinkRequiredstringThe link address.
sScreenTipTextRequiredstringThe screen tip text.

Returns

ApiHyperlink | null

Example

This example adds a hyperlink to the specified range.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("ONLYOFFICE Document Builder");
let range = doc.GetRange(0, 9);
range.AddHyperlink("https://www.onlyoffice.com/", "Main portal");